<template>
    <!-- 底部部分 -->
    <footer class="footer">
      <span class="todo-count"><strong>{{countList}}</strong>剩余</span>
      <ul class="filters">
        <li>
          <a :class="{selected:type==='all'}" href="#/" @click="changeList('all')">全部</a>
        </li>
        <li>
          <a :class="{selected:type==='active'}" href="#/active" @click="changeList('active')">进行中</a>
        </li>
        <li>
          <a :class="{selected:type==='completed'}" href="#/completed" @click="changeList('completed')">已完成</a>
        </li>
      </ul>
      <button class="clear-completed" v-if="showList" @click="clearList">清除已完成</button>
    </footer>
</template>
 
<script>
export default {
   name: "TodoListFooter",
   props:{
    countList: {
      type:Number,
      required:true,
    },
    showList: {
      type: Boolean,
      required:true
    },
    type: {
      type: String,
      required:true,
    }
   },
   methods: {
    // 子传父
    clearList(){
      this.$emit('clearList')
   },
   changeList(value) {
    this.$emit('changeList', value)
   }
   }
};
</script>

<style scoped>
     
</style>